The function checks whether a value is within a defined value range.
The value range is defined with a set point and a range around this set point. The function calculates the low limit and high limit of the value range.
| LGF_IsValueInRange (FC) | ||||||||
|---|---|---|---|---|---|---|---|---|
| LReal | value | Ret_Val | Bool | |||||
| LReal | setpoint | overHighLimit | Bool | |||||
| LReal | range | belowLowLimit | Bool | |||||
| error | Bool | |||||||
| status | Word | |||||||
| Identifier | Data type | Description |
|---|---|---|
| value | LReal | Value to be checked to determine whether it is within the defined value range |
| setpoint | LReal | Set point |
| range | LReal | Area where the setpoint is in range |
| Identifier | Data type | Description |
|---|---|---|
| Ret_Val | Bool | Return: TRUE if the “value” is in the value range (range of the set point) |
| overHighLimit | Bool | TRUE if the “value” is greater than the upper limit value |
| belowLowLimit | Bool | TRUE, if the “value” is less than the lower limit value |
| error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB |
| status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table) |
| Code / Value | Identifier / Description |
|---|---|
| 16#0000 | STATUS_NO_ERROR Status: no error occurred |
| 16#8401 | ERR_RANGE_LIMIT_VALUES Error: During calculating of the limit values |
The setpoint and range variables define a range of values.
The function checks whether the value is below, in or above the value range. The outputs belowLowLimit, Ret_Val, or overHighLimit show where the value is located.
Figure: Principle of operation
| Version & Date | Change description | |
|---|---|---|
| 1.0.0 | Siemens Industry Online Support | |
| 30.01.2017 | First released version | |
| 1.0.1 | Siemens Industry Online Support | |
| 17.08.2018 | Upgrade: TIA V15 Update 2 | |
| 1.0.2 | Siemens Industry Online Support | |
| 23.11.2018 | Upgrade: TIA V15.1 | |
| 1.1.0 | Simatic Systems Support | |
| 13.11.2019 | renamed from "LGF_HighLowLimit" to "LGF_IsValueInRange" Code refactoring error values changed, regions, comments and constant’s are added | |
| 3.0.0 | Simatic Systems Support | |
| 23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library | |
| 3.0.1 | Simatic Systems Support | |
| 12.11.2020 | Insert documentation | |